using Aurora.TaskScheduler.Abstractions;
using Aurora.TaskScheduler.Abstractions.BaseModel;
using Aurora.TaskScheduler.Abstractions.SchedulerAttributes;
using Gateway.IApplication.UserMessage;

namespace Gateway.UI.Api.TaskJobs;

/// <summary>
/// 删除数据
/// </summary>
[Cron("0 0 0 * * ?", "每天0点执行一次", description: "Gateway-UI-API,删除逻辑删除的数据")]
public class DeleteDataJob : ITaskJob<string>
{
    private readonly IUserMessageApp _userMessageApp;

    /// <summary>
    /// 
    /// </summary>
    /// <param name="userMessageApp"></param>
    public DeleteDataJob(IUserMessageApp userMessageApp)
    {
        _userMessageApp = userMessageApp;
    }

    /// <summary>
    /// 
    /// </summary>
    /// <param name="parameter"></param>
    /// <returns></returns>
    public async Task<JobResult> ExecuteAsync(string parameter)
    {
        await _userMessageApp.RemoveLongTimeNoUse();
        return new JobResult
        {
            Success = true,
            Message = "删除成功"
        };
    }
}